﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;

namespace LiteFrame
{
    class Security
    {
        /// <summary>
        /// 获取MD5加密字符串
        /// </summary>
        /// <param name="Source"></param>
        /// <returns></returns>
        public static string GetMD5String(string Source)
        {
            return BitConverter.ToString(GetMD5Bytes(Source));
        }
        public static string GetBinEncodeString(string Source, string pinKey)
        {
            //
            return null;
        }

        private static byte[] GetMD5Bytes(string Source)
        {
            System.Security.Cryptography.MD5CryptoServiceProvider md5Prov = new System.Security.Cryptography.MD5CryptoServiceProvider();
            return md5Prov.ComputeHash(System.Text.UTF8Encoding.UTF8.GetBytes(Source));
        }


        private static byte[] GetKeyFromPinKey(string PinKey)
        {
            //PinKey是一个MD5加密的128位bit串，现将前64位和后64位分开，然后与用户ID结合在做一次MD5运算
            return null;
        }

        private static byte[] GetVIFromPinKey(string PinKey)
        {
            return null;
        }

    }
}
